<template>
  <template v-if="JSON.stringify(itemData) !== '{}'">
    <div class="top-info">
      <div class="user-info">
        <p class="base-info fl">
          <span class="name">{{itemData.name}}</span><span>{{itemData.company}}</span
          ><!----><i class="vline"></i><span class="base-title">{{itemData.posts}}</span
          ><!---->
        </p>
        <div class="fr right-content">
          <a href="javascript:" class="btn-v2 btn-light-v2 op-settop tooltip tooltip-top">置顶</a>
        </div>
      </div>
      <div class="chat-position-content">
        <div class="main">
          <a href="javascript:;" ka="geek_chat_job_detail" class="position-content"
            ><span class="position-name">{{itemData.positionName}}</span><span class="salary" style="">{{itemData.salary}}</span
            ><span class="city">{{itemData.city}}</span></a
          >
          
        </div>
        <!----><!---->
      </div>
    </div>
    <div class="message-content">
      <div class="chat-record">
        <div class="chat-message">
          <ul class="im-list">
            <!----><!---->
            <template v-for="(item,index) in itemData.messageList" :key = "index">
              <li :class="item.myself ? 'item-myself' : 'item-friend'">
                <div class="message-text">
                  <!---->
                  <div class="figure" v-if = "!item.myself">
                    <img
                      src="https://img.bosszhipin.com/beijin/upload/avatar/20230812/607f1f3d68754fd0b12b6bcdec2a25dcb163e708d79de589249f99c7dcd9b7b26ddf073d33b57240_s.jpg.webp"
                      alt=""
                      class="image-circle"
                    />
                  </div>
                  <div class="text">
                    <i class="status status-read" v-if="item.myself"></i>
                    <div>
                      <p>
                        <!----><!----><!----><span
                          >{{item.message}}</span
                        ><!----><!----><!----><!---->
                      </p>
                    </div>
                  </div>
                </div>
              </li>
              <li class="item-time"><span class="time">{{item.time}}</span></li>
            </template>
          </ul>
        </div>
        <ul class="right-click-panel" style="display: none">
          <li class="">撤回</li>
        </ul>
      </div>
      <div class="message-tip-bar"><!----><!----><!----><!----></div>
    </div>
    <messageControl :boss="false"></messageControl>
    <div class="interview-modal" style="display: none">
      <div class="dialog-interview-default">
        <div class="interview-wrap">
          <div class="interview-article"><span>面试详情</span></div>
          <!---->
          <div class="interview-loading"><i class="icon-toast-loading"></i></div>
        </div>
      </div>
    </div>
  </template>
  <template v-else>
    <div   class="chat-no-data">
      <div >
        <img
          src="https://static.zhipin.com/fe-zhipin-geek/web/chat/v5150/static/images/icon-welcome.16c2a037.png"
          alt=""
        />
        <div  class="welcome-tips">
          <p >与您进行过沟通的 Boss 都会在左侧列表中显示</p>
        </div>
      </div>
    </div>
  </template>
</template>

<!-- ------------------- -->
<script setup lang="ts">
import { useUserStore } from '@/store/modules/user'
import { storeToRefs } from 'pinia'
import messageControl from '@/components/chat/messageControl.vue'
const userStore = useUserStore()
const { itemData } = storeToRefs(userStore)
let disabled = ref(true)
let inputMessage = ref(null)

function inputChange() {
  disabled.value = inputMessage.value.innerText === ''
}
// 这里进行消息发送
function btnSubmit() {
  let message = inputMessage.value.innerText
  inputMessage.value.innerText = ''
  console.log(message)
}
</script>

<!-- ------------------- -->

<style scoped>
.user-info {
  position: relative;
  height: 48px;
  justify-content: space-between;
  padding: 0 30px;
}

.user-info,
.user-info .base-info {
  display: flex;
  align-items: center;
}

.user-info .name {
  line-height: 25px;
  margin-right: 20px;
}
.user-info span {
  font-size: 14px;
  font-weight: 400;
  color: #666;
  line-height: 22px;
}
.user-info .vline {
  margin: 0 6px;
}

.user-info .base-title {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-info .right-content .btn-v2 {
  padding: 0 10px;
}

.chat-position-content {
  position: relative;
  width: 770px;
  background: linear-gradient(90deg, #f5fcfc, #fcfbfa);
  padding: 16px;
  border-radius: 12px;
  margin: auto;
}

.chat-position-content .main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 24px;
}

.chat-position-content .position-content {
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

.chat-position-content .position-content span {
  font-size: 16px;
  color: #555;
  line-height: 22px;
  margin-left: 16px;
}

.chat-position-content .position-content span:first-child {
  margin-left: 0;
}

.chat-position-content .position-content .position-name {
  font-weight: 500;
  color: #222;
}

.chat-position-content .position-content .salary {
  font-size: 20px;
  font-family: kanzhun-Regular, kanzhun;
  color: #fe574a;
  line-height: 24px;
  vertical-align: bottom;
}

.chat-position-content .position-content .city {
  color: #333;
}

.chat-position-content .guide-content {
  white-space: nowrap;
  font-size: 12px;
  font-weight: 400;
  color: #00a6a7;
  line-height: 17px;
  margin-right: 0;
}

.chat-conversation .message-content {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.image-circle {
  border-radius: 50%;
}

.right-click-panel {
  background: #fff;
  border: 1px solid #e3e7ed;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.14);
  border-radius: 2px;
  line-height: 30px;
  position: fixed;
  z-index: 999;
  user-select: none;
}

.chat-conversation .message-controls {
  height: 160px;
}

.chat-op {
  user-select: none;
  padding-bottom: 5px;
  padding-top: 5px;
  text-align: right;
}

.chat-op .tip {
  padding-right: 20px;
  color: #ccc;
}

.chat-op .btn-send {
  font-size: 14px;
  line-height: 26px;
  min-width: auto;
  height: 28px;
  margin-right: 0;
  padding: 0 16px;
  border-radius: 6px;
}

.chat-op .disabled,
.chat-op .disabled:hover {
  cursor: default;
  color: #ededed;
  border-color: #ededed;
  background-color: #fff;
}
</style>
